<?php
/**
 * User: krisbuist
 * Date: 1/31/12
 * Time: 2:14 PM
 */
class NameGenerator
{
    private $namesCsvDoc;
    private $numberOfNames;

    public function __construct()
    {
        $csvReader = new CSVReader();
        $this->namesCsvDoc = $csvReader->parse_file(APPPATH . 'libraries/generators/randomNames.csv');
        $this->numberOfNames = sizeof($this->namesCsvDoc);
    }

    public function generateName()
    {
        return $this->randomElement('firstNameFirst');
    }

    public function randomElement($element)
    {
        $random = rand(0,$this->numberOfNames-1);
        return $this->namesCsvDoc[$random][$element];
    }
}
